<div class="findtrs">
	<form action="" class="layui-inline layui-form" method="post">
		<div class="ftitle">
			<div class="lt">
				<h2>在线充值</h2>
			</div>
		</div>
		<div class="fremittance fbai">
			<div class="fnobeinfo">
				<div class="ftl"><h3>1.收款信息</h3></div>
				<div class="fremitls">
					<ul>
						<li>
							<div class="receiving">
								<div class="fre">支付宝</div>

								<dl>
									<dd>
										<label class="lab">Account Number（账户名称）：{$alipay_number}</label>
									</dd>
									<dd>
										<label class="lab">Account Name（账户姓名）：{$alipay_name}</label>
									</dd>
								</dl>
							</div>
						</li>
						<li>
							<div class="receiving">
								<div class="fre">微信</div>
								<dl>
									<dd>
										<label class="lab">Account Holder（账户名称）：{$wechat_number}</label>
									</dd>
									<dd>
										<label class="lab">Account Name（账户姓名）：{$wechat_name}</label>
									</dd>
									<dd></dd>
									<dd></dd>
									<dd class="ho">
										<div class="fnote">
											Note：<br />
											{$fund_desc|raw}
										</div>
									</dd>
								</dl>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<div class="fremittanpred fbai">
			<div class="txt">
				<h2>
					2.提交汇款预报<i>（{$sub_fund_desc}）</i>

				</h2>
				<p>完成汇款操作后，请尽快填入您的汇款详情并上传汇款底单，提交审核成功后方能完成美金账户充值。请注意核实录入的信息，以免影响您的充值进度。</p>
			</div>
			<div class="list">
				<ul>
					<li>
						<label>转账日期 <i>*</i></label>
						<div class="time" >
							<input type="text" id="test1" class="info" name="date" lay-verify="required" lay-verType="tips" placeholder="请选择日期" >
							<div class="fic"><img src="__STATIC__/lib/index/images/fd7.png" alt=""></div>
						</div>
					</li>
					<li>
						<label>充值金额 <i>*</i></label>
						<select name="amount" id="amount" lay-filter="amount" lay-verify="required" lay-verType="tips">
							<option value="50" {if $default_amount == 50}selected{/if}>$ 50</option>
							<option value="100" {if $default_amount == 100}selected{/if}>$ 100</option>
							<option value="200" {if $default_amount == 200}selected{/if}>$ 200</option>
							<option value="500" {if $default_amount == 500}selected{/if}>$ 500</option>
						</select>
					</li>
					<li>
						<label>&nbsp;</label>
						<div class="fzhu">$ <span id="start_usa">{$default_amount}</span> * {$usa_rate} = ¥ <span id="end_usa" style="color: red">{:getSprintf($usa_rate * $default_amount)}</span></div>
					</li>
					<li></li>
					<li>
						<label>充值渠道<i>*</i></label>
						<select name="pay_type" lay-verify="required" lay-verType="tips">
							<option value="">请选择</option>
							<option value="1">支付宝</option>
							<option value="2">微信</option>
						</select>
					</li>
					<li>
						<label>付款人帐号<i>*</i></label>
						<input type="text" class="info" name="name" lay-verify="required" lay-verType="tips" placeholder="请输入付款人账号" >
					</li>
					<li>
						<label>&nbsp;</label>
						<div class="fzhu">注：所有额外费用均由付款方承担</div>
					</li>
					<li></li>
					<li class="fload">
						<label>付款交易截图</label>
						<div class="fupload" style="float: left">
							<input type="hidden" name="upload_img" id="upload_img" value="">
							<div class="en" id="addBtn">
								<div class="ico"><img src="__STATIC__/lib/index/images/fd6.png" alt=""></div>
								<h4>立即上传</h4>
							</div>
						</div>
						<div class="layui-upload-list" id="photo-list" style="float: right">
							<img class="layui-upload-img" id="addPic" style="max-width: 150px;max-height: 200px">
							<p id="notice"></p>
						</div>
					</li>
				</ul>
			</div>
			<i style="font-size: 20px;">* 未 <a href="javascript:;" style="font-size: 21px;font-weight: bold;color: red" id="ftianj"> 实名认证 </a> 用户提交无效.
				</span><br/><br/>
			</i>
			<input type="button" class="fsubmit" lay-submit lay-filter="edit" value="提交审核" >
		</div>
	</form>

</div>
<script type="text/javascript">
	layui.use(['form','laydate','upload'], function(){
		var laydate = layui.laydate;
		var form = layui.form;

		//执行一个laydate实例
		laydate.render({
			elem: '#test1' //指定元素
		});

		form.on('submit(edit)', function(data){
			var loading =layer.load(1, {shade: [0.1,'#fff']});
			JsPost("{:url('onLine')}", data.field, function(res){
				const grade = '{$grade}';
				if(grade == 0){
					window.location.href = "{:url('user/account')}";
					return false;
				}
				layer.close(loading);
				if(res.code >0){
					layer.msg(res.msg, {time:1500}, function(){
						window.location.href = "{:url('user/account')}";
					});
				}else{
					layer.msg(res.msg , {time:1500});
				}
			})
		});

		$('#ftianj').click(function(){
			const grade = '{$grade}';
			if(grade != 0){
				layer.msg('用户已认证', {time:1500});
				return false;
			}
			window.location.href = "{:url('user/account')}";
		})

		//普通图片上传
		var uploadInt = layui.upload.render({
			elem: '#addBtn',                //绑定元素
			url: '{:url("index/UpOssLoads")}',       //上传接口
			//*********************传输限制
			size: 2048,                   //传输大小100k
			exts: 'jpg|png|gif',        //可传输文件的后缀
//            , accept: 'file'              //video audio images
			//****************传输操作相关设置
//            , data: { Parm1: "hello", Parm2: "world" }    //额外传输的参数
//            , auto: false                                 //自动上传,默认是打开的
//            , bindAction: '#btnUpload'                    //auto为false时，点击触发上传
			multiple: false,                            //多文件上传
			before: function(obj){
				//预读本地文件示例，不支持ie8
				obj.preview(function(index, file, result){
					$('#addPic').attr('src', result); //图片链接（base64）
				});
			},
			done: function (res) {                      //传输完成的回调
				if(res.code>0){
					//layer.msg('upload success',{icon: 1, time: 1500});
					$('#upload_img').val(res.img_url);
				}else{
					//如果上传失败
					layer.msg('upload error',{icon: 2, time: 1500});
				}
			},
			error: function () {                         //传输失败的回调
				//演示失败状态，并实现重传
				var notice = $('#notice');
				notice.html('<br /><span style="color: #FF5722;">upload error</span> ' +
						'<a class="layui-btn demo-reload">retry</a>');
				notice.find('.demo-reload').on('click', function(){
					uploadInt.upload();
				});
			}
		});

		$('#photo-list img').on('click', function () {
			layer.photos({
				photos: '#photo-list',
				shadeClose: false,
				closeBtn: 2,
				anim: 0
			});
		})

		form.on('select(amount)',function(data){
			const amount = $('#amount').val();
			const usa_rate = "{$usa_rate}";
			var total_money = parseFloat(amount)*parseFloat(usa_rate);
			var total_money = total_money.toFixed(4);
			var total_money = parseFloat(total_money);
			$("#start_usa").text(amount);
			$("#end_usa").text(total_money);
		})
	});
</script>